import { http } from '@/utils/http'

export interface NewsItem {
  id: number
  title: string
  content: string | null
  frontImg: string
  publishtime: string
  looknum: number
}

export interface NewsData {
  totalCount: number
  items: NewsItem[]
}

/** 新闻列表 */
export const newsList = ({
  Title = '',
  page = 1,
  limit = 10,
}: { Title?: string; page?: number; limit?: number } = {}): Promise<IResData<NewsData>> => {
  return http.get<NewsData>('/api/MP/GetNewsList', { Title, page, limit })
}

/** 新闻详情 */
export const getNewsDetail = (id: number): Promise<IResData<NewsItem>> => {
  return http.get<NewsItem>('/api/MP/GetNews', { id })
}
